package com.itheima.users.entity;

public class Result {
    private int code;
    private String msg;
    private Object data;

    private static final int OK = 0 ;
    private static final int error = 1 ;
    private static final String ok_Msg = "操作成功,ok" ;

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static com.itheima.chap04.Result ok (Object date){
        return new com.itheima.chap04.Result(OK, ok_Msg , date);
    }


    public static com.itheima.chap04.Result ok (){
        return ok( null);
    }

    public static com.itheima.chap04.Result error (String msg){
        return new com.itheima.chap04.Result(error, msg , null);
    }

    public boolean issuccess(){
        return code == OK;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
